package edu.bu.cs673.superkids123.children.view.components;

import java.awt.BorderLayout;
import java.util.List;

import javax.swing.DefaultListModel;
import javax.swing.JList;
import javax.swing.JPanel;

import edu.bu.cs673.superkids123.common.model.Achievement;

public class AchievementsEarnedPanel extends JPanel {

	private static final long serialVersionUID = 1L;
	
	public AchievementsEarnedPanel(List<Achievement> earned) {
		super();
		this.setLayout(new BorderLayout());
		
		DefaultListModel listModel = new DefaultListModel();
		
		listModel.addElement("Achievements unlocked!");

		for (Achievement a : earned) {
			String text = String.format("%s %s \u2605", a.getName(), a.getPoints());
			listModel.addElement(text);
		}

		JList list = new JList(listModel);
		this.add(list, BorderLayout.CENTER);
	}

}
